package com.myastro.main;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;

public class FrameBuffer 
{
	public FrameBuffer(Context parent)
	{
		mParentContext = parent;
		
		mLocalFile = new LocalFile(this);
	}
	
	public FrameBuffer(Context parent, Bitmap srcImg)
	{
		mParentContext = parent;
		mSrcImg = srcImg;
		
		mLocalFile = new LocalFile(this);
	}
	
	public FrameBuffer(Context parent, View view)
	{
		mParentContext = parent;
		
		view.getRootView().setDrawingCacheEnabled(true);
		view.getRootView().buildDrawingCache();
		final Bitmap srcImg = view.getRootView().getDrawingCache();
		
		mSrcImg = srcImg;
		
		mLocalFile = new LocalFile(this);
	}
	
	public void open(int mode)
	{
		mLocalFile.open(mode);
	}
	
	public void save(Bitmap bitmap) {
		mLocalFile.write(bitmap);
	}
	

	// ------
	
	private Context mParentContext = null;
	private LocalFile mLocalFile = null;
	private Bitmap	  mSrcImg = null;

}
